package com.woniu.springcrud.service.impl;

import com.woniu.springcrud.entity.Permission;
import com.woniu.springcrud.mapper.PermissionMapper;
import com.woniu.springcrud.service.PermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: 16327
 * @date: 2021/1/19 17:47
 * @description:
 */
@Service
public class PermissionServiceImpl implements PermissionService {
    @Autowired
    PermissionMapper PermissionMapper;
    @Override
    public List<Permission> findAll() {
        List<Permission> Permissions = PermissionMapper.selectByExample(null);
        return Permissions;
    }

    @Override
    public int deletePermissionById(Integer id) {
        int i = PermissionMapper.deleteByPrimaryKey(id);
        return i;
    }

    @Override
    public int updatePermission(Permission permission) {

        int i = PermissionMapper.updateByPrimaryKey(permission);
        return i;
    }

    @Override
    public int insertPermission(Permission permission) {

        return PermissionMapper.insert(permission);
    }
}
